import myAxios from "@/request/myAxios.ts";
import qs from "qs";

// 根据标签搜索用户
export const searchUserTag = async (tags:Array<string>,currentPage:number) => {
    return  await myAxios.get('/user/search/tags',{
        params: {
            tagNameList: tags,
            currentPage
        },
        paramsSerializer: params => {
            return qs.stringify(params, {indices: false})
        }
    })
        .then(function (response) {
            // handle success
            return response.data?.data.records;
        })
        .catch(function (error) {
            console.log("/user/search/tags error", error);
        })
}

// 根据用户名搜索用户
export const searchUserName = async (userName:String) => {
    return myAxios.get('/user/search',{
        params: {
            username: userName
        }
    })
}
